package com.leonyip.firstdemo.controller;

import com.leonyip.firstdemo.dao.UserDao;
import com.leonyip.firstdemo.entity.User;
import com.leonyip.firstdemo.service.UserServie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RequestMapping("/test")
@RestController
public class TestController {
    @Autowired
    private UserServie userServie;
    @GetMapping("/hello")
    public String hello(){
        return "你好，这是一个Controller";
    }

    @GetMapping("/getUser")
    public User getUser(Integer id){
        return userServie.getById(id);
    }

    @GetMapping("/getAll")
    public List<User> getAll(){
        return userServie.getAll();
    }

    @GetMapping("/findByUserName")
    public List<User> findByUserName(String userName){
        return userServie.findByUserName(userName);
    }

   /* @GetMapping("findByPage")
    public List<User> findByPage(int pageNum, int pageSize){
        return userServie.getByPage(pageNum,pageSize);
    }*/
}
